# Featherweight Linux handout

by Akkana Peck.
This handout and presentation: http://shallowsky.com/featherweight/

## Lightweight distros:

- Puppy
- Xubuntu
- Damn Small Linux (DSL)
- Tiny Core
- Crunchbang
- Debris
- LXDE.org has links to Lubuntu and LXE Debian
- Lubuntu
- LXE Debian

## Netbook distros:

- Ubuntu netbook remix
- Moblin (Intel)
- Google Android (optimized for ARM) and Chrome OS

## Lightweight window managers:

- Openbox
- Fluxbox
- Icewm
- Fvwm
- Ratpoison
- Ion

## Dock apps, applets, desktop switchers etc.

- Cool programs to run with Openbox
- or google: linux dock apps

## Word processors:

- Plain text (e.g. emacs, vim, leafpad, kate, nano, gedit)
- HTML (Komposer, Seamonkey's composer, bluefish)
- RTF (e.g. Leafpad)
- abiword, kword
- Lyx, Kile (if you know TeX/latex)

## Mail programs

- GUI: sylpheed, balsa
- Text: mutt, alpine

## PDF:

- xpdf
- evince

## Presentation software:

(see my Linux for Presentations HOWTO for a detailed list)

- HTML (e.g. with S5 or using custom-written CSS/JS as in my Featherweight slides).
- xpdf (to create presentations, use LaTeX beamer, Seminar, Prosper, AxPoint, PythonPoint or many other options)
- Special-purpose programs, e.g. magicpoint or Perl bruce

## Browsers

- ascii, no graphics: lynx, links, w3m
- tiny, no CSS or JS: dillo
- tiny and better: netsurf
- promising but unstable: midori, kazehakase
- even more promising: arora
- roll-your-own: GtkLauncher, webbrowser.py (demo apps for webkitgtk)

## Speeding up boot:

- Build a non-modular kernel (modules cost 1/2 second each!)
- Cut out unneeded services (disable init scripts)
- hardware: solid-state disk

## Possibly unnecessary services:

Consider removing the packages, or at least disabling the init files:

Watch during boot -- see what's slow.

Read files in /etc/init.d to find out what the services are doing.

Don't take my list and automatically disable everything -- Figure out what you do and don't need.

- avahi (Apple zeroconf protocol)
- CPUFreq (unless it works on your hardware)
- apparmor (do you use it?)
- bluetooth (do you have it? use it every time you boot?)
- WPA (ditto)
- PPP-DNS (using a modem? with a fixed resolv.conf?)
- dhcdbd, DHCP dbus daemon (do you switch networks often, without shutting down or suspending in between?
- usplash (pretty boot screen -- but how much do you care?)
- laptop-mode (are you on a laptop? use CPU throttling, etc.?)
- apmd (using a machine from before 2001?)
- aumix (no-op, Ubuntu has used ALSA for at least 6 years)
- apport (cool, but do you use it?)
- NetworkManager (do you use it?)
- NFS (IMPORTANT: don't disable mountkernfs along with *nfs* !)
- nvidia (do you have nvidia and use the closed-source drivers?)
- xserver-xorg-input-wacom (do you have a wacom, and use it every boot?)

## Optional services:

Services that you may want sometimes, but not necessarily every time you boot:

- apache2
- cups
- WPA
- exim
- postfix

## How to disable init scripts (Redhat)

- Redhat: chkconfig apache2 off

## How to disable init scripts (Debian/Ubuntu)

- chkconfig (depends on insserv, which doesn't work on ubuntu)
- update-rc.d apache2 stop 91 2 3 4 5 .
- sysv-rc-conf --list, sysv-rc-conf apache2 off
- bum (boot-up manager, GUI tool)
- Rename files:

      $ runlevel
      $ cd /etc/rc2.d
      $ sudo mv S91apache2 K91apache2

- Make noinit.d:

      $ mkdir /etc/noinit.d
      $ mv /etc/init.d/apache2 /etc/noinit.d

  Start services when you need them:

      sudo /etc/noinit.d/apache2 start

## fsck

- tune2fs -c 50 /dev/sda5 <-- count
- tune2fs -i 1m /dev/sda5 <-- time (months)
- disable by setting last field in /etc/fstab to 0: `/dev/sda5 /home ext3 relatime 0 0`
- disable checkfs.sh file in init.d (ReiserFS users should do this anyway: it has a bug that makes it check Reiser filesystems every time)
- showfsck: show time to next check
- dumpe2fs -h /dev/sdb1 | grep -i 'mount count'
- autofsck: prompts at logout (requires gdm)

## Solid-State disks (SSD)

- faster reading (cut boot time in half); slower writing; small ones are cheap
- use for system directories, small /home
- use a HD (even external) for big stuff like photos, files/directories that get changed a lot

## bootlogd on Ubuntu

- /etc/init.d/bootlogd: complete no-op on Ubuntu
- /etc/default/bootlogd: don't bother enabling

Has to do with Upstart instead of sysvinit.

bug 94120 on removing the no-op files or installing the patch.

(also bug 306998)

bug 98955 and bug 328881 on doing the same thing with logd.

Instead, watch during boot, see what's slow.

Turn on boot messages by editing /boot/grub/menu.lst:

    kernel /boot/vmlinuz-2.6.28-11-generic root=[...] ro quiet splash

Or use bootchart.

## Performance tools

- GUI: conky, xosview, gnome-system-monitor (if running gnome)
- top -b -n 1
  - P: sort by %CPU
  - M: sort by %mem
  - T: sort by cumulative time
- Be sure to read the STUPID TRICKS SAMPLER at the end of the top man page.
- >a href="http://www.linuxforums.org/misc/using_top_more_efficiently.html">Using TOP more efficiently
- ps u (user format, processes owned by you)
- ps uax (user format, all processes)
- Sorting: ps uaxO -C (-C is sort by CPU; -r for RSS, -v for virtual size). Look for OBSOLETE SORT KEYS in man ps.
- ps axSO -C o user,pid,pcpu,pmem,vsz,rss,stat,time,comm
- Sometimes you can use --sort, e.g. `ps ax --sort=-pcpu` but that seems more brittle, sometimes breaks. (Look for STANDARD FORMAT SPECIFIERS in the man page.)
- vmstat is good for monitoring both memory (see below) and CPU: try `vmstat 1` to update every 1 sec.
- powertop (measure power use, find CPU hogs)
- Hardware: Kill-a-Watt
- Bootchart
- iostat, hdparm (hdparm -d /dev/da: check whether you're using DMA properly)

## HAL, "Hardware Abstraction Layer"

- Watches for hardware changes, takes action
- polls a few times/second per storage device
- Disable polling on one device: hal-disable-polling --device /dev/cdrom
- Disable polling on ALL devices: chmod 000 /usr/lib/hal/hald-addon-storage

## Memory

- RSS: Resident Set Size (what's currently loaded into RAM)
- VSZ: Virtual Size (RSS, what's swapped to disk, plus unused mmapped areas)
- SZ: Size, virtually meaningless, ignore it

## Memory tools

- gmemusage (broken in Ubuntu jaunty, see patch in bug 370735).
- /proc/$pid/statm
- exmap (needs kernel module)
- ps_mem.py
- pmap -d [process_id]
- free, vmstat (before+after running a process).
- Beware readahead! tune by disabling /etc/init.d/readahead or adjusting /etc/readahead

## Quetzy (Poop Snake)

Don't forget to go see the statue of Quetzalcoatl! (The link goes to San Jose Underbelly, a don't-miss guide to the real San Jose.)